<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆销售信息列表')" />
</head>
<body class="gray-bg">


<div class="modal fade" id="add_one_record_modal" role="dialog" aria-describedby="add_one_record_modal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" type="button" data-dismiss="modal" aria-label="Close">&times;</button>
                <h4 class="modal-title">入库和销售的全部信息</h4>
            </div>
            <div class="modal-body">
                <form id="add_one_record_form" action="/add_one" method="post" role="form" data-remote="true">
                    VIN码<input class="form-control" type="text" id="gender1" name="name">
                    车牌号<input class="form-control" type="text" id="gender2"  name="age">
                    行驶证时间<input class="form-control" type="text" id="gender3"  name="gender">
                    上牌区域<input class="form-control" type="text" id="gender4"  name="gender">
                    购车领域<input class="form-control" type="text" id="gender5"  name="gender">
                    购买单位<input class="form-control" type="text" id="gender6"  name="gender">
                    销售时间<input class="form-control" type="text" id="gender7"  name="gender">
                    车主<input class="form-control" type="text" id="gender8"  name="gender">
                    车辆行驶证编号<input class="form-control" type="text" id="gender9"  name="gender">
                    销售时间<input class="form-control" type="text" id="gender10"  name="gender">
                    开发票日期<input class="form-control" type="text" id="gender11"  name="gender">
                    发票编号<input class="form-control" type="text" id="gender12"  name="gender">
                    生产批次号 <input class="form-control" type="text" id="gender13"  name="gender">
                    质检状态<input class="form-control" type="text" id="gender14"  name="gender">
                    车辆合格证编号<input class="form-control" type="text" id="gender15"  name="gender">
                    整车保质期<input class="form-control" type="text" id="gender16"  name="gender">
                    销售时间<input class="form-control" type="text" id="gender17"  name="gender">
                    出厂时间<input class="form-control" type="text" id="gender18"  name="gender">
                    车辆状态<input class="form-control" type="text" id="gender19"  name="gender">
                    录入时间<input class="form-control" type="text" id="gender20"  name="gender">
                </form>
            </div>
        </div>
    </div>
</div>




     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>vin码：</label>
                                <input type="text" name="vin"/>
                            </li>
                            <li>
                                <label>车牌号：</label>
                                <input type="text" name="carNum"/>
                            </li>
                            <li>
                                <label>上牌区域：</label>
                                <input type="text" name="registrationArea"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="sale:sale:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="sale:sale:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sale:sale:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="sale:sale:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('sale:sale:edit')}]];
        var removeFlag = [[${@permission.hasPermi('sale:sale:remove')}]];
        var prefix = ctx + "sale/sale";

        window.operateEvents={
            'click #xn':function (e,value,row,index) {
                alert(value)
               /* $.ajax({
                    url:"/car/config/getConfigById/"+value,
                    type:"get",
                    dataType:"json",
                    success:function (d) {
                        console.log(d)
                        $("#gender1").val(d.configName);
                        $("#gender2").val(d.carTypeId);
                        $("#gender3").val(d.carWeight);
                        $("#gender4").val(d.carWeight);
                        $("#gender5").val(d.carLong);
                        $("#gender6").val(d.carWide);
                        $("#gender7").val(d.carPassengers);
                        $("#gender8").val(d.driverMode);
                        $("#gender9").val(d.chargeRatio);
                        $("#gender10").val(d.pureBatteryRange);
                        $("#gender11").val(d.speedHundred);
                        $("#gender12").val(d.maxSpeed);
                        $("#gender13").val(d.ratioGear);
                        $("#gender14").val(d.maxSpeed30m);
                        $("#gender15").val(d.rateOilRate);
                        $("#gender16").val(d.powerHundred);
                    }
                })*/
            }
        }



        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "车辆销售信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键-车辆销售表',
                    visible: false
                },
                    {
                        field: 'carId',
                        title: '车辆外键'
                    },
                    {
                        field: 'vin',
                        title: 'VIN码',
                        events:'operateEvents',
                        formatter: function(value, row, index) {
                            return ' <a class="btn btn-primary" id="xn"  data-toggle="modal" data-target="#add_one_record_modal">'+value+'</a>';
                        }
                    },
                {
                    field: 'carNum',
                    title: '车牌号'
                },
                    {
                        field: 'saleStatus',
                        title: '车辆状态',
                        formatter: function(value, row, index) {
                            if(value==0){
                                return '未销售';
                            }else if(value ==1){
                                return '已销售';
                            }
                        }
                    },
                {
                    field: 'registrationTime',
                    title: '行驶证时间'
                },
                {
                    field: 'registrationArea',
                    title: '上牌区域'
                },
                {
                    field: 'carField',
                    title: '购车领域'
                },
                {
                    field: 'buyer',
                    title: '购买单位/根据购车领域改变'
                },
                {
                    field: 'saleDate',
                    title: '销售时间'
                },
                {
                    field: 'saleUserName',
                    title: '车主'
                },
                {
                    field: 'saleCarCode',
                    title: '车辆行驶证编号'
                },
                {
                    field: 'saleXiaoshouDate',
                    title: '销售时间'
                },
                {
                    field: 'saleXiaoshouName',
                    title: '销售人员'
                },
                {
                    field: 'invoiceDate',
                    title: '开发票日期'
                },
                {
                    field: 'invoiceNumber',
                    title: '发票编号'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
